﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using Eassets.Layered.Domain.Secure;
using Eassets.Data.Secure;


namespace Eassets.Service.Secure
{
    public class ScreenService
    {
        ScreenData screendata = new ScreenData();

        /// <summary>
        /// Inserts screen.
        /// </summary>
        /// <param name="screen"></param>
        public void AddScreen(Screen screen)
        {
            if (screen != null)
            {
                screendata.AddScreen(screen);
            }
        }

        /// <summary>
        /// Updates screen.
        /// </summary>
        /// <param name="screen"></param>
        public void ModifyScreen(Screen screen)
        {
            if (screen != null)
            {
                screendata.ModifyScreen(screen);
            }
        }

        /// <summary>
        /// Delete screen.
        /// </summary>
        /// <param name="screenId"></param>
        public void DeleteScreen(long screenId)
        {
            if (screenId != 0)
            {
                screendata.DeleteScreen(screenId);
            }
        }

        /// <summary>
        /// GetbyId screen.
        /// </summary>
        /// <param name="screenId"></param>
        /// <returns></returns>
        public Screen GetByIdScreen(long screenId)
        {
            return screendata.GetByIdScreen(screenId);
        }

        /// <summary>
        /// Get screen by module id
        /// </summary>
        /// <param name="moduleId"></param>
        /// <returns></returns>
        public Collection<Screen> GetScreenByModuleId(long moduleId)
        {
            return (Collection<Screen>)screendata.GetAllScreen().Where(x => x.EassetModuleId == moduleId);
        }

        /// <summary>
        /// GetAll screen.
        /// </summary>
        /// <returns></returns>
        public Collection<Screen> GetAllScreen()
        {
            return screendata.GetAllScreen();
        }
    }
}

